package day17.zhiyou100;



import java.io.*;

public class Demo01_OutputStream {
    public static void main(String[] args) throws Exception {
        File file = new File("D:\\file\\io\\a.txt");
        OutputStream os = new FileOutputStream(file);
        os.write("你好世界".getBytes());
        os.write("\r\n".getBytes());
        os.write("你好Java".getBytes());

        InputStream is = new FileInputStream(file);
        byte[] bytes = new byte[1024];
        int len=0;
        while((len=is.read(bytes))!=-1){
            System.out.println(new String(bytes,0,len));
        }
       System.out.println(new String(bytes));


    }
}
